package com.yyg.usecase.springbootwebdemo.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;
import java.util.concurrent.*;

@Configuration
public class ThreadPoolConfig {

    @Bean
    public ExecutorService queryExecutor() {
        ExecutorService executorService = new ThreadPoolExecutor(100, 100, 10, TimeUnit.MINUTES,
                new ArrayBlockingQueue<>(500), new NumberedThreadFactory("query-executor"), new ThreadPoolExecutor.AbortPolicy());
        return executorService;
    }

}
